import java.util.ArrayList;

public class Main2 {
    private static double testSet(Set<String> set,String filename){
        long startTime = System.nanoTime();
        System.out.println(filename);
        ArrayList<String> words = new ArrayList<>();
        if (FileOperation.readFile(filename,words)){
            System.out.println("Total words:" + words.size());

            for (String word : words){
                set.add(word);
            }
            System.out.println("Total different words: " + set.getSize());
        }

        long endTime = System.nanoTime();

        return (endTime - startTime) / 1000000000.0;


    }
    public static void main(String[] args) {
        String filename = "/Users/liuyifan/IdeaProjects/Data-Structures/07-Set/src/pride-and-prejudice.txt";

        double time1 = testSet(new BSTSet<>(), filename);
        System.out.println("BST Set: "+time1+" s");

        System.out.println();

        double time2 = testSet(new LinkedListSet<>(), filename);
        System.out.println("Liked list Set: "+time2+" s");
    }
}
